# def func():
#     print(111)
#     v1=yield 1 #返回1并封存住，再把444赋值给v1
#     print(v1)
#
#     print(222)
#     v2=yield 2
#     print(v2)
#
#     print(333)
#
# data=func()
# n1=data.send(None)
# print(n1)
# n2=data.send(444)
# print(n2)
#


#内置函数
"""第一组：数学运算相关的：abs绝对值，pow指数函数，sum求和，divmod求商和余数，round小数点后n位(四舍五入）"""
# print(abs(-2))
# print(pow(2, 3))
# print(sum([1,2,3]))#参数可以被迭代
# print(divmod(9,2))
# print(round(3.1415926,3))

"""第二组：循环对数据进行处理的：min最小值，max最大值，all是否全部为True,any是否存在True"""
# print(min(1,4,7,0.1))
# print(max([1,4,-7,0.1],key=lambda x: abs(x)))#加工完之后再比较
# print(all([11,22,0]))
# print(any([True,False,True]))

"""第三组:进制转化：bin,otc,hex"""

"""第四组：ord获取数字对应的unicode对应的码点（十进制），chr根据码点（十进制）获取对应的字符"""
# print(ord("王"))
# print(chr(65))

"""第五组：int flaot str bytes bool list dict tuple set  """
# v1="xiaowang"
# v2=v1.encode("utf-8")
# v3=bytes(v1,"utf-8")

"""第六组：len print input open type range enumerate id hash哈希值转化 help zip callable是否可执行
 sorted 排序"""
# for i in range(10):print(i)
# v1=['xiaofeng',1,'超市']
# for num,value in enumerate(v1,1):
#     print(num,value)
#
# import random
# print(hash("小王"))
# help(random)#获取帮助手册

# v1=[1,2,3]
# v2=[4,5,6]
# v3=[7,8,9,10]
# result=zip(v1,v2,v3)#列表里面套列表，生成迭代器
# for i in result:
#     print(i)

#callable 画面是否可以加括号
# v1='sxsx'
# def v2():
#     return 1
# print(callable(v1))
# print(callable(v2))


# v1=[11,44,8,2,0]
# print(sorted(v1,reverse=True))
# print(sorted(v1))

info={
    'k1': {
        "id":20 ,
        "age":10
    },
    'k3': {
        "id":3 ,
        "age":3
    },
    'k4': {
        'id':5,
        "age":8
    }
}
print(sorted(info))
print(sorted(info.items(),key=lambda x:x[1]['id']))